
-- LUA script for example game
-- player script


function Added(entity)

	-- store information important for this entity.
	
	scriptobject = {}
	scriptobject.transform = GetTransformComponent(entity)
	scriptobject.physics = GetPhysicsComponent(entity)

	-- store it in the entity table. this is created in start.lua
	entitytable[entity] = scriptobject
end


function Process(entity)
	this = entitytable[entity]

	if KeyDown(KEY_LEFT) then
		this.transform:AddRotation(-3)
	end
	if KeyDown(KEY_RIGHT) then
		this.transform:AddRotation(3)
	end
	if KeyDown(KEY_UP) then
		this.physics:AddAcceleration(this.transform:GetRotation(), 0.03)
   end
    
end


function Removed(entity)
	entitytable[entity] = nil
end
